Many operating systems provide facilities for dynamic binding of program modules which are independently compiled as shared libraries or dynamic link libraries (DLLs). Dynamic binding offers the advantages of strong modularization, code reuse, improved cache behavior, and reduced compilation time as well other advantages. However, the complex instruction sequences that are generated for calls to and between shared libraries may inhibit performance.
In some systems, the interface to “foreign procedures” in shared library modules is accomplished with a procedure linkage table (PLT). The reason that a foreign procedure in a dynamically loaded shared library module cannot be called directly is that the address of the foreign procedure is unknown until runtime. The PLT provides a writable data segment that can be updated by a dynamic loader with the addresses of the foreign procedures. Even though the term “procedure” is used in this description, it will be appreciated that the invention is applicable to other functional elements such as functions, routines, or methods as known in various languages.
Each entry in the PLT contains information for referencing a foreign procedure, either in the form of an address of a foreign procedure or the address of a loader routine located within the dynamic loader. When an application tries to branch to a target procedure via the PLT and the corresponding PLT entry contains a pointer to the loader routine, the loader routine is executed. The loader routine identifies the target procedure and overwrites the PLT entry with the information for referencing the target procedure. In an alternative method, the dynamic loader fills all the PLT entries on the loading of a module. For both methods of filling the PLT, the facts remains that the PLT must be accessed in order to branch to a foreign procedure, and any access to the PLT is a costly read from memory.
A system and method that address the aforementioned problems, as well as other related problems, are therefore desirable.